<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>传输站</title>
    <script src="./js/vue.min.js"></script>
    <link rel="stylesheet" href="./styles/iconfont.css">
    <link rel="stylesheet" href="./styles/index.css">
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>
    <div class="body-bg"></div>
    <div id="app" class="container" v-cloak>
        <div class="up-part">
            <div class="chat-header">
                <div class="whispers" @click.stop="isWhispers = !isWhispers">
                    <div :class="'box' + (isWhispers?' active':'')"></div>
                    <span>悄悄话</span>
                </div>
                <div class="status" v-if="wsStatus !== 2">
                    {{wsStatus?'连接成功':'正在连接...'}} (在线人数：{{onlineNum}})
                </div>
                <div class="status close" v-else>
                    连接已断开
                </div>
            </div>

            <div class="chat-wrap" ref="chat">
                <template v-for="(item, index) in chatList">
                    <div :class="'chat-box ' + (item.uuid === uuid?'right':'left')" :key="index">
                        <div class="nickname-time">
                            <span class="nickname">{{item.nickname}}</span>
                            <span class="time">{{item.createTime}}</span>
                        </div>
                        <div class="headimg" :style="'background-image: url(' + item.avatar + ')'"></div>
                        <div class="content-box" v-if="item.contents.length">
                            <template v-for="(aItem, aIndex) in item.contents">
                                <div class="txt">{{aItem}}</div>
                            </template>
                        </div>
                        <div class="img-box" v-else-if="item.image">  
                            <img class="img" :src="item.image"  />
                            <i class="iconfont icon-jiazai" v-if="item.tempId"></i>
                        </div>
                    </div>
                </template>
            </div>

        </div>
        <div class="under-part">
            <div class="more-feature">
                <label class="box">
                    <input ref="file" type="file" accept="image/jpg,image/jpeg,image/png" name="file"
                        @change="onChooseImage($event)" />
                    <i class="iconfont icon-image"></i>
                </label>
            </div>
            <textarea v-model="content"></textarea>
            <div class="btn-wrap">
                <button class="btn" @click.stop="sendMsg">发 送</button>
            </div>
        </div>
    </div>

    <script src="./js/axios.min.js"></script>
    <script src="./js/searchImage.js"></script>
    <script src="./js/index.js?v=2"></script>

</body>

</html>